﻿using AutoStar.Common;
using AutoStar.Views;
using GalaSoft.MvvmLight.CommandWpf;
using SharpGL.SceneGraph;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;

namespace AutoStar.ViewModel
{
    public class WindowLayerVM : BaseViewModel
    {
        public WindowLayerVM()
        {
            CancelCommand = new RelayCommand(CloseWindow);
            //OKCommand = new RelayCommand(OK);
            //_SelectedChannel = "通道1";
        }

        //public void OK()
        //{
        //    if (Global.printLayer.mode >= 10)//如果是通过分层切片方式自动添加的打印层
        //    {
        //        //修改层高
        //        for (int i = 0; i < Global.printLayer.points.Count; i++)
        //        {
        //            Global.printLayer.points[i].Z = float.Parse(Global.layerVM.X);
        //        }
        //        Global.printLayer.z_start = float.Parse(Global.layerVM.Z);
        //        //修改固化时间
        //        Global.printLayer.solidfyTime = int.Parse(Global.layerVM.Time);
        //        //修改通道
        //        if (SelectedChannel == "通道1")
        //            Global.printLayer.channel = 0;
        //        else if (SelectedChannel == "通道2")
        //            Global.printLayer.channel = 1;
        //        else if (SelectedChannel == "通道3")
        //            Global.printLayer.channel = 2;
        //        else if (SelectedChannel == "通道4")
        //            Global.printLayer.channel = 3;
        //        else if (SelectedChannel == "通道5")
        //            Global.printLayer.channel = 4;
        //        AddLayerEvent(Global.printLayer);
        //    }
        //    else
        //    {
        //        AddLayerEvent(new PrintLayer(Tag, Global.printLayer.channel, float.Parse(Interval), float.Parse(Width), float.Parse(Length), float.Parse(X), float.Parse(Y), float.Parse(Z), int.Parse(Time), float.Parse(Height)));
        //    }
        //}
        ////声明委托
        //public delegate void LayerDelegate(PrintLayer layerChanged);
        ////声明事件
        //public event LayerDelegate AddLayerEvent;
        public ObservableCollection<string> _printChannels = new ObservableCollection<string>()
            {
                "通道1","通道2","通道3","通道4","通道5","通道6","通道7"
            };
        public ObservableCollection<string> PrintChannels
        {
            get => _printChannels;
            set => Set(ref _printChannels, value);
        }
        private bool _Is1Checked = false;
        public bool Is1Checked
        {
            get => _Is1Checked;
            set => Set(ref _Is1Checked, value);
        }
        private bool _Is2Checked = false;
        public bool Is2Checked
        {
            get => _Is2Checked;
            set => Set(ref _Is2Checked, value);
        }
        private bool _Is3Checked = false;
        public bool Is3Checked
        {
            get => _Is3Checked;
            set => Set(ref _Is3Checked, value);
        }
        private int _Tag = 0;
        public int Tag
        {
            get => _Tag;
            set => Set(ref _Tag, value);
        }
        private string _X = "0";
        public string X
        {
            get => _X;
            set => Set(ref _X, value);
        }
        private string _Y = "0";
        public string Y
        {
            get => _Y;
            set => Set(ref _Y, value);
        }
        private string _Z = "0";
        public string Z
        {
            get { return _Z; }
            set { _Z = value; }
        }
        private string _Width = "0";
        public string Width
        {
            get => _Width;
            set => Set(ref _Width, value);
        }
        private string _Height = "0";
        public string Height
        {
            get => _Height;
            set => Set(ref _Height, value);
        }
        private string _Length = "0";
        public string Length
        {
            get => _Length;
            set => Set(ref _Length, value);
        }
        private string _Interval = "0";
        public string Interval
        {
            get => _Interval;
            set => Set(ref _Interval, value);
        }
        private string _Time = "0";
        public string Time
        {
            get => _Time;
            set => Set(ref _Time, value);
        }
        private string _SelectedChannel = "通道1";
        public string SelectedChannel
        {
            get => _SelectedChannel;
            set => Set(ref _SelectedChannel, value);
        }
        private ICommand _closeCommand;
        public ICommand OKCommand { get; private set; }
        public ICommand CancelCommand { get; private set; }
        private void CloseWindow()
        {
        }

        // 事件声明  
        public event EventHandler CloseRequested;
    }
}
